package com.member.bsl;

import java.sql.SQLException;
import java.util.HashMap;
import com.member.dao.MemberDAO;
import com.member.entity.Member;

public class LoginHandler extends BasePage {

	public String emailID;
	public String Password;
	public String Fname;
	public String Lname;
	public String Address;
	public String Country;
	public String State;
	public String City;

	public LoginHandler() {
		// msViewPage = "register.jsp";
		// msDetailPageId = "CountryDetail";
	}

	public void setRequest(HashMap requestParam) {
		emailID = (String) requestParam.get("eid");
		Password = (String) requestParam.get("pwd");
		Fname = (String) requestParam.get("fname");
		Lname = (String) requestParam.get("lname");
		Address = (String) requestParam.get("add");
		City = (String) requestParam.get("city");
		State = (String) requestParam.get("state");
		Country = (String) requestParam.get("con");
		
		performRegistration();
	}

	public boolean performRegistration() {
		boolean flag = false;
		Member userObj = new Member(emailID, Password, Fname, Lname, Address,
				City, State, Country);
		MemberDAO userDao = new MemberDAO();
		try {
			flag = userDao.insertPersonInfo(userObj);
			if (flag) {
				flag = true;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return flag;

	}

}
